package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                        import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.SmsRecallMapper;
import com.ruoyi.bizsys.domain.SmsRecall;
import com.ruoyi.bizsys.service.ISmsRecallService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 召回短信Service业务层处理
 *
 * @author african-loan
 * @date 2021-12-30
 */
@Service
public class SmsRecallServiceImpl extends ServiceImpl<SmsRecallMapper,SmsRecall> implements ISmsRecallService {

    /**
     * 查询召回短信
     *
     * @param id 召回短信ID
     * @return 召回短信
     */
    @Override
    public SmsRecall selectSmsRecallById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询召回短信列表
     *
     * @param smsRecall 召回短信
     * @return 召回短信
     */
    @Override
    public List<SmsRecall> selectSmsRecallList(SmsRecall smsRecall) {
        return this.list(new QueryWrapper<>(smsRecall).last("order by id desc"));
    }

    /**
     * 新增召回短信
     *
     * @param smsRecall 召回短信
     * @return 结果
     */
            @Override
    public int insertSmsRecall(SmsRecall smsRecall) {
                                                                                                                                                                                smsRecall.setCreateTime(DateUtils.getNowDate());
                                                                    return baseMapper.insert(smsRecall);
    }

    /**
     * 修改召回短信
     *
     * @param smsRecall 召回短信
     * @return 结果
     */
            @Override
    public int updateSmsRecall(SmsRecall smsRecall) {
                                                                                                                                                                                                                        smsRecall.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(smsRecall);
    }

    /**
     * 批量删除召回短信
     *
     * @param ids 需要删除的召回短信ID
     * @return 结果
     */
            @Override
    public int deleteSmsRecallByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除召回短信信息
     *
     * @param id 召回短信ID
     * @return 结果
     */
    @Override
    public int deleteSmsRecallById(Long id) {
        return baseMapper.deleteById(id);
    }

}
